<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户充值</title>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <style>
        .layui-input-block input{
            width:250px;
        }

    </style>
</head>
<body>

    <!--<form class="" action="#">-->
        <div class="layui-form-item">
            <label class="layui-form-label">余额:</label>
            <div class="layui-input-block" style="text-align: center;">
                <!--<input id="kuaidi_sn" type="text" name="kuaidi_sn" class="layui-input" value="{$list.yu_e_num}">-->
                <label class="layui-form-label"> {$list.yu_e_num}</label>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">充值金额:</label>
            <div class="layui-input-block">
                <input id="chongzhinum" type="number" name="chongzhinum" class="layui-input" value="">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button data-id="{$list.uid}" id="chongzhi" class="layui-btn" >充值</button>
            </div>
        </div>
        <input id="id" type="hidden" value="{$list.uid}">
    <!--</form>-->
    <script type="text/javascript">
        // var editor = UE.getEditor('container');
    </script>
    <script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
    <script src="__PUBLIC__/js/jquery-1.11.1.min.js" charset="utf-8"></script>
    <script type="text/javascript">
        layui.use(['element','laypage','layer'], function(){
            var element = layui.element
                ,$ = layui.jquery
                ,layer = layui.layer
                ,laypage = layui.laypage;
            var count = $("#count").val();

            $("#chongzhi").on('click', function(event) {
                var id = $(this).data('id');
                // alert(id)

                var chongzhinum = $('#chongzhinum').val();
                // if(parseFloat(chongzhinum)<0){
                //     layer.alert('请正确填写金额');
                //     return;
                // }
                $.ajax({
                    url:'{:U("doChongZhi")}',
                    data:{"chongzhinum":chongzhinum,"uid":id},
                    type:'post',
                    dataType:'json',
                    success:function(d){
                        // layer.alert(d);
                        if(1 == d){
                            layer.alert('充值成功');
                            setTimeout(function(){
                                window.parent.location.reload();
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                            },2000);
                        }else{
                            layer.alert('充值失败');
                        }
                    }
                })
            });
        });
    </script>
</body>
</html>